package com.ruoyi.service.impl;

import com.ruoyi.entity.Classes;
import com.ruoyi.mapper.CourseMapper;
import com.ruoyi.service.CourseService;
import com.ruoyi.utils.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class CourseServiceImpl implements CourseService {

    @Resource
    private CourseMapper courseMapper;

    public Result courseList() {

        List<Classes> list=courseMapper.courseList();

        return Result.success(list);
    }

    public Result courseSave(Classes classes) {
        if (classes.getClassesId()==null){
            courseMapper.courseAdd(classes);
            return Result.success();
        }

        courseMapper.courseUpdate(classes);
        return Result.success();
    }

    public Result courseDel(Integer id) {

        courseMapper.courseDel(id);

        return Result.success();
    }
}
